//
//  RegisterViewController.m
//  Futures
//
//  Created by Cheng on 2017/6/29.
//  Copyright © 2017年 Cheng. All rights reserved.
//

#import "RegisterViewController.h"
#import "LoginTextField.h"

@interface RegisterViewController ()

@property (weak, nonatomic) IBOutlet LoginTextField *accountView;

@property (weak, nonatomic) IBOutlet LoginTextField *verificationCodeView;

@end

@implementation RegisterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
//    self.title = @"免费注册";
    [self.verificationCodeView setLoginTextFieldWithTitle:@"验证码" placeholder:@"请输入短信验证码"];
    
//    [self addToolbarOnKeyboard:self.accountView.textField];
//    [self addToolbarOnKeyboard:self.verificationCodeView.textField];
    
    [self addGetVerificationCodeBtn];
    
}


- (void)addGetVerificationCodeBtn{
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [btn setTitle:@"获取验证码" forState:UIControlStateNormal];
    btn.backgroundColor = UICOLOR_RGB_Alpha(0xc15cc1, 1);
    btn.titleLabel.font = [UIFont systemFontOfSize:11];
    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    btn.layer.cornerRadius = 3.f;
    btn.layer.masksToBounds = YES;
    [btn addTarget:self action:@selector(clickGetVerificationCode:) forControlEvents:UIControlEventTouchUpInside];
    [self.verificationCodeView addSubview:btn];
    
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.verificationCodeView).offset(-25);
        make.bottom.equalTo(self.verificationCodeView).offset(-15);
        make.size.mas_equalTo(CGSizeMake(65, 28));
    }];
}

- (void)clickGetVerificationCode:(UIButton *)sender{
    sender.backgroundColor = UICOLOR_RGB_Alpha(0x999999, 1);
    [sender setTitle:@"请重试(59)" forState:UIControlStateNormal];
    sender.enabled = NO;
}


- (IBAction)clickAgree:(id)sender {
    UIButton *btn = sender;
    btn.selected = !btn.isSelected;
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    self.navigationController.navigationBar.barTintColor = UICOLOR_RGB_Alpha(0x0d0d0d, 1);
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    
    self.navigationController.navigationBar.barTintColor = UICOLOR_RGB_Alpha(0x202020, 1);
}


@end
